package code.temp.log;

import javax.swing.*;
import java.awt.*;
/**
 * <b>Description : </b>
 *
 * @author CPF
 * @date 2020/10/30 15:12
 **/
public class Dialog extends JFrame {
    private String str;

    public Dialog(String str) {
        this.str = str;
        new Thread(this::initGUI).start();
    }

    private void initGUI() {
        setUndecorated(true);
        setLocationRelativeTo(null);
        setVisible(true);
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        {
            JLabel text = new JLabel("<html>" + str + "</html>", SwingConstants.CENTER);
            getContentPane().add(text, BorderLayout.CENTER);
            text.setBackground(new java.awt.Color(255, 251, 240));
        }
        pack();
        Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        setBounds(screenSize.width / 2 - 180, screenSize.height - 150, 360, 100);
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e1) {
            e1.printStackTrace();
        }
        dispose();
    }

}